/**
 * <p>Copyright (c) 2017 深圳市鹏途交通科技有限公司 				</p>
 * <p>		    All right reserved. 		     			</p>
 * <p>项目名称 ：深圳公路信息资源整合及国省检日常化监管管理        				</p>
 * <p>创建者 ：詹春贤 										</p>
 * <p>描   述  ：路政管理 - 基础建设 - 路政信息化记录控制器 			</p>
 * <p>最后修改 ：$: 2017年9月7日-上午9:25:14 v 1.0.0	 Administrator   $   </p>
 * 
*/

package com.pengtu.gsj.controller.lzgl;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.pengtu.gsj.controller.base.DefaultBaseController;
import com.pengtu.gsj.dao.base.Page;
import com.pengtu.gsj.dao.base.QueryFilter;
import com.pengtu.gsj.entity.lzgl.RoadInfoSys;
import com.pengtu.gsj.interceptor.Token;
import com.pengtu.gsj.service.lzgl.RoadInfoSysService;

/**
 * 
 * RoadInfoSysController
 * 
 * 2017年9月7日 上午9:25:14
 * 
 * @version 1.0.0
 * 
 */
@Controller
@RequestMapping("roadInfoSys")
public class RoadInfoSysController extends DefaultBaseController {
	
	@Autowired
	private RoadInfoSysService roadInfoSysService;
	
	/**
	/**
	 * 加载
	 * @param id
	 * @return
	 */
	@ModelAttribute
	public RoadInfoSys load(String id){
		RoadInfoSys roadInfoSys;
		if(StringUtils.isNotEmpty(id)){
			roadInfoSys = roadInfoSysService.getRoadInfoSysById(id);
		}else{
			roadInfoSys = new RoadInfoSys();
		}
		return roadInfoSys;
	}
	
	
	/**
	 * 页面跳转
	 * @return
	 */
	@RequestMapping("listInfo")
	@Token(save = true)
	public String showLisfInfo() {
		return "lzgl/roadInfoSys_list";
	}
	
	
	@RequestMapping(value="list", produces = "application/json; charset=utf-8")
	@ResponseBody
	public Page<RoadInfoSys> getRoadMaterialList(Page<RoadInfoSys> page, HttpServletRequest request){
		QueryFilter queryFilter = QueryFilter.buildFromHttpRequest(request);
		if (!page.isOrderBySetted()) {
			page.setOrderBy("year");
			page.setOrder(Page.ASC);
		}
		page = roadInfoSysService.findRoadInfoSys(page,queryFilter);
		return page;
	}
	
	/**
	 * 保存
	 * @param roadInfoSys
	 * @return
	 */
	@RequestMapping(value = "save", method=RequestMethod.POST)
	@ResponseBody
	@Token(remove = true)
	public boolean saveRoadInfoSys(@ModelAttribute RoadInfoSys roadInfoSys){
		roadInfoSysService.saveRoadInfoSys(roadInfoSys);
		return true;
	}
	
	
	/**
	 * 加载数据
	 * @param roadInfoSys
	 * @return
	 */
	@RequestMapping(value="show")
	@ResponseBody                                                     
	public RoadInfoSys showRoadInfoSys (@ModelAttribute RoadInfoSys roadInfoSys){
		return roadInfoSys;
	}
	
	/**
	 * 删除
	 * @param roadInfoSys
	 * @return
	 */
	@RequestMapping(value="delete")
	@ResponseBody
	public boolean delateInfoManagement(@ModelAttribute RoadInfoSys roadInfoSys){
		roadInfoSysService.delateRoadInfoSys(roadInfoSys);
		return true;
	}
}
